package com.yanqu.road.server.cmd.thief;

import com.yanqu.road.pb.thief.ThiefProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.thief.ThiefModule;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.ClientProtocol;
import com.yanqu.road.server.protocol.GameProtocol;

@Cmd(code = GameProtocol.S_THIEF_CREATE_GUIDE, desc = "生成引导小偷")
public class CreateGuideThiefCmd extends AbstractCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        ret = player.getModule(ThiefModule.class).createGuideThief();
    }

    @Override
    public void sendData(GamePlayer player) {
        if (ret != 0) {
            ThiefProto.CreateGuideThiefRespMsg.Builder builder = ThiefProto.CreateGuideThiefRespMsg.newBuilder();
            builder.setRet(ret);
            player.sendPacket(ClientProtocol.U_THIEF_CREATE_GUIDE, builder);
        }
    }
}
